#-*- coding:utf-8 -*-
import json
import sys
import os
class JsonParserHelper:

    def __init__(self):
        path_dir = os.path.dirname(os.path.realpath(__file__))
        self.inFileName = path_dir + '/../IR/gov_info.json'
        self.keyList = ["buyerName","projectName","money","time"]
        pass

    def getJsonList(self):

        content = None
        f = None
        f = open(self.inFileName)
        with open(self.inFileName) as f:
            content = f.read()

        jsonObject = json.loads(content)
        # print json.dumps(jsonObject,ensure_ascii=False)
        dct = jsonObject['govInfo']
        lst = []
        for i in dct:
            lstTemp = []
            # for key in i.keys(): # this will make the order of the list wrong
            #     lstTemp.append(i[key])
            for key in self.keyList:
                lstTemp.append(i[key])
            lst.append(lstTemp)
        return lst
        #     for value in i:
        #         lstTemp += value
        #     lst += lstTemp
        # return lst    


if __name__ == '__main__':
    reload(sys)
    sys.setdefaultencoding( "utf-8" )
    jph = JsonParserHelper()

    lst = jph.getJsonList()
    print lst